import Vue from 'vue'
import Router from 'vue-router'


Vue.use(Router)

const router = new Router({
  routes: [
    {
      path: '',
      redirect: '/manage'
    },
    {
      path: '/manage',
      //路由懒加载
      component: () => import('@/views/home'),
      children: [
        {
          path: '',
          redirect: '/manage/worker'
        },
        {
          path: 'worker',
          component: () => import('@/views/home/worker')
        },
        {
          path: 'job',
          component: () => import('@/views/home/job')
        },
        {
          path: 'task',
          component: () => import('@/views/home/task')
        },
        {
          path: 'system',
          component: () => import('@/views/home/system')
        },
        {
          path: 'workProgress',
          component: () => import('@/views/home/workProgress')
        },
      ]
    },
  ],
  mode: 'history'
})
//判断是否登录
// router.beforeEach((to, from, next) => {
//   next();
//   // let user = JSON.parse(localStorage.getItem("user"));
//   // if (!user && to.path !== '/login') {
//   //   next({path: '/login'})
//   // } else {
//   //   next();
//   // }
// })
export default router
